<?php
/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */

namespace support;

use support\utils\Form;

/**
 * Class Request
 * @package support
 * @property $uid
 */
class Request extends \Webman\Http\Request
{
    public function getForm()
    {
        return new Form(input());
    }

    public function isMobile()
    {
        $userAgent = request()->header('HTTP_USER_AGENT');
        $mobileKeywords = array('Android', 'iPhone', 'iPad', 'Windows Phone');
        foreach ($mobileKeywords as $keyword) {
            if (stripos($userAgent, $keyword) !== false) {
                return true;
            }
        }
        return false;
    }

    public function isPost()
    {
        return strtolower(request()->method()) === "POST";
    }

    public function isGet()
    {
        return strtolower(request()->method()) === "GET";
    }

    public function isLogic()
    {
        return request()->uid > 0;
    }

}